home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 15 / BBS in a box XV-1.iso / Files / Internet / Misc / Uupc 3.1 sources.sit / uupc 3.1 sources Folder / Mac specific / mlib.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-01  |  669 b   |  51 lines  |  [TEXT/KAHL]

  1. /*        lib.c
  2.  
  3.  
  4.         macintosh library
  5.         
  6.  
  7.     Things to do in uu host
  8.  
  9.         serial I/O
  10.         
  11.         directory stuff
  12.             opendir, readdir, closedir
  13.  
  14.         prolog and epilog
  15.  
  16.         system call
  17.  
  18. */
  19.  
  20. #include <stdio.h>
  21. #include "host.h"
  22. #ifndef  THINK_C
  23. #include <sgtty.h>
  24.  
  25. #include "mlib.proto.h"
  26.  
  27. int get_one(void)
  28. {
  29.     char c;
  30.     
  31.     struct sgttyb stty, sttyo;
  32.     ioctl( 0, TIOCGETP, &stty );
  33.     sttyo = stty;
  34.     stty.sg_flags |= CBREAK;
  35.     stty.sg_flags &= ~ ECHO;
  36.     ioctl( 0, TIOCSETP, &stty );
  37.     c = fgetc( stdin );
  38.     ioctl( 0, TIOCSETP, &sttyo );
  39.     return( c );
  40. }
  41. #else
  42. # include <console.h>
  43. get_one(void) {
  44.     int ch;
  45.     csetmode(C_CBREAK, stdin);
  46.     ch = getc(stdin);
  47.     csetmode(C_ECHO, stdin);
  48.     return(ch); 
  49. }
  50. #endif
  51.